<!DOCTYPE html>
<html>
<head>
	<title>加载动画</title>
	<style type="text/css">
.mask_load{
    position: fixed;
    top:0;
    left:0;
    z-index: 1000;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,.1)
}
.mask_load_box{
    position: absolute;
    top:50%;left:50%;
    width:90px;height:90px;
    transform: translate(-50%,-50%);
}
.spinner {
  width: 90px;
  height: 90px;
  position: relative;
  text-align: center;   
  -webkit-animation: rotate 2.0s infinite linear;
  animation: rotate 2.0s infinite linear;
}
.dot1, .dot2 {
  width: 60%;
  height: 60%;
  display: inline-block;
  position: absolute;
  top: 0;
  background-color:deepskyblue;
  border-radius: 100%;
   
  -webkit-animation: bounce 2.0s infinite ease-in-out;
  animation: bounce 2.0s infinite ease-in-out;
}
.dot2 {
  top: auto;
  bottom: 0px;
  -webkit-animation-delay: -1.0s;
  animation-delay: -1.0s;
}
 
@-webkit-keyframes rotate { 
    100% { -webkit-transform: rotate(360deg) }
}
@keyframes rotate { 
    100% { transform: rotate(360deg); 
        -webkit-transform: rotate(360deg) 
        }
    }
 
@-webkit-keyframes bounce {
  0%, 100% { 
    -webkit-transform: scale(0.0)
  }
  50% { 
    -webkit-transform: scale(1.0)
  }
}
 
@keyframes bounce {
  0%, 100% {
    transform: scale(0.0);
    -webkit-transform: scale(0.0);
  } 50% {
    transform: scale(1.0);
    -webkit-transform: scale(1.0);
  }
}		

	</style>
</head>
<body>
<!-- <div class="mask_load">
	<div class="mask_load_box">
		<div class="spinner">
			<div class="dot1"></div>
			<div class="dot2"></div>
		</div>
	</div>
</div> -->
<script type="text/javascript">
window.showLoadMask=function(){
    var html=`<div class="mask_load_box"><div class="spinner"><div class="dot1"></div><div class="dot2"></div></div></div>`
    var div=document.createElement("div");
    	div.id="maskLoad";
    	div.className="mask_load"
    	div.innerHTML=html;
        var first=document.body.firstChild;//得到页面的第一个元素 
		document.body.insertBefore(div,first);//在得到的第一个元素之前插入
}
window.hideLoadMask=function(){
     var mask=document.getElementById("maskLoad");
	mask.parentNode.removeChild(mask);
}
showLoadMask();
setTimeout(hideLoadMask,3000)
</script>

</body>
</html>